{extend name="panel/layout" /}
{block name="main"}
<div class="row">
    <div class="col-md-12 col-sm-6">
        <div class="widget">
            <header class="widget-header">
                <h4 class="widget-title">下单说明</h4>
            </header>
            <hr class="widget-separator">
            <div class="widget-body">
                {:getHtmlCode(config('web_gg_dgadd'))}
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <div class="widget">
            <header class="widget-header">
                <h4 class="widget-title">自助下单
                <span class="pull-right">
                    <label class="label label-success pull-right">
                        剩余金币：{$userInfo.point}
                    </label>
                </span>
                </h4>
            </header><!-- .widget-header -->
            <hr class="widget-separator">
            <div class="widget-body">
                <form method="post" class="form-horizontal">
                    <input type="hidden" name="mod" value="coin">
                    <div class="form-group">
                        <label class="control-label col-sm-3">选择下单QQ:</label>
                        <div class="col-sm-9">
                            <select class="form-control" name="qid">
                                {volist name="qqList" id="qq"}
                                <option value="{$qq.qid}" {if condition="$qq.qid eq $aqid" }selected{
                                /if}>{$qq.uin}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">代挂项目:</label>
                        <div class="col-sm-9">
                            <select class="form-control" name="tid" id="dgtid" onchange="getPoint();">
                                {volist name="toolList" id="tool"}
                                <option value="{$tool.tid}" price="{$tool.price}">{$tool.name}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">下单月数:</label>
                        <div class="col-sm-9">
                            <div class="input-group">
                                <input type="number" name="num" value="1" id="num" class="form-control"
                                       onchange="getPoint();" required>
                                <div class="input-group-addon">月</div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">消耗金币:</label>
                        <div class="col-sm-9">
                            <div class="input-group">
                                <input type="text" value="{$price_all}" class="form-control" id="need"
                                       disabled>
                                <div class="input-group-addon">个</div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-sm-3"></label>
                        <div class="col-sm-9">
                            <button class="btn btn-success" type="submit">&lt;&lt;&lt;下单&gt;&gt;&gt;</button>
                        </div>
                    </div>
                </form>
            </div><!-- .widget-body -->
        </div><!-- .widget -->
    </div>
    <div class="col-md-12">
        <div class="widget">
            <header class="widget-header">
                <h4 class="widget-title">卡密下单
                </h4>
            </header><!-- .widget-header -->
            <hr class="widget-separator">
            <div class="widget-body">

                <form method="post" class="form-horizontal">
                    <input type="hidden" name="mod" value="kami">
                    <div class="form-group">
                        <label class="control-label col-sm-3">选择下单QQ:</label>
                        <div class="col-sm-9">
                            <select class="form-control" name="qid">
                                {volist name="qqList" id="qq"}
                                <option value="{$qq.qid}" {if condition="$qq.qid eq $aqid" }selected{
                                /if}>{$qq.uin}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">代挂项目:</label>
                        <div class="col-sm-9">
                            <div class="input-group">
                                <input type="text" class="form-control"
                                       value="全套代挂" disabled>
                                <div class="input-group-addon"></div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">代挂卡密:</label>
                        <div class="col-sm-9">
                            <div class="input-group">
                                <input type="text" name="km" id="km" class="form-control"
                                       placeholder="代挂卡密不是余额卡密，请仔细分辨！" required>
                                <div class="input-group-addon"></div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-sm-3"></label>
                        <div class="col-sm-9">
                            <button class="btn btn-success" type="submit">&lt;&lt;&lt;下单&gt;&gt;&gt;</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="footJs"}
<script type="text/javascript">
    function getPoint() {
        var value = $('#num').val();
        var tid = $('#dgtid option:selected').val();
        var price = {$price_dx};
        if (tid == 1) {
            price = {$price_all};
        }
        $('#need').val((value * price).toFixed(2));
    }
</script>
{/block}
